package srv

import (
	"go.uber.org/zap"
	"venus/service/sv_ws"
	"venus/util/zlog"
)

func WsRegister() {
	sv_ws.Bind("test", wsTest)
}

func wsTest(msg *sv_ws.WsMsg) {

	req := msg.Msg
	zlog.Debug("ws test",
		zap.Uint32("ConnID", msg.WsClient.ConnID),
		zap.Any("args", req),
	)

	data := "rsp_data"
	rsp := &sv_ws.WsApi{
		Cmd:  req.Cmd,
		Code: 1,
		Data: data,
	}

	//// 示例注册完成
	//player := &objects.Player{}
	//// 玩家其他信息
	//player.WsClient = msg.WsClient
	//msg.WsClient.BindUid = player.Pid
	//msg.WsClient.BindObj = player

	msg.Send(rsp)
}
